import { Tabs } from "antd";
import { Drawing } from "@/components/Configuration/FileProps/Drawing.tsx";
import { Correspondence } from "@/components/Configuration/FileProps/Correspondence.tsx";
import { LayoutProps } from "@/components/Configuration/FileProps/LayoutProps.tsx";
import { LayerStructure } from "@/components/Configuration/FileProps/LayerStructure.tsx";
import React from "react";
import { FileMainProps } from "@/types";
import { ScrollChildren } from "@/components/Configuration/ScrollChildren.tsx";

function FileProps(props: FileMainProps) {
  return (
    <>
      <Tabs
        animated
        size={"small"}
        centered
        onChange={(key) => {
          sessionStorage.setItem("FilePropsKey", key);
        }}
        defaultActiveKey={
          sessionStorage.getItem("FilePropsKey") == "LayerStructure"
            ? "Drawing"
            : sessionStorage.getItem("FilePropsKey") || "Drawing"
        }
        items={[
          {
            key: "Drawing",
            label: "图纸",
            children: (
              <ScrollChildren>
                <Drawing {...props} />
              </ScrollChildren>
            ),
          },
          {
            key: "Correspondence",
            label: "通信",
            children: (
              <ScrollChildren>
                <Correspondence {...props} />
              </ScrollChildren>
            ),
          },
          {
            key: "LayoutProps",
            label: "布局",
            children: (
              <ScrollChildren>
                <LayoutProps />
              </ScrollChildren>
            ),
          },

          {
            key: "LayerStructure",
            label: "结构",
            children: (
              <ScrollChildren>
                <LayerStructure {...props} />
              </ScrollChildren>
            ),
          },
        ]}
      />
    </>
  );
}
export default React.memo(FileProps);
